import { Component, OnInit } from '@angular/core';
import { PlatformuserService } from '../../service/platformuser.service';
import { AgentcashserviceService } from '../../service/agentcashservice.service';

import { RoleService } from '../../service/role.service';
import { CommonService } from '../../service/common.service';
import { NzMessageService } from 'ng-zorro-antd';
import { RoleRight } from '../../../kalend';
@Component({
  selector: 'app-sysuerlist',
  templateUrl: './agentcashinfo.component.html',
  styleUrls: ['./agentcashinfo.component.scss'],
  providers: [PlatformuserService, RoleService,AgentcashserviceService]
})
export class AgentcashinfoComponent implements OnInit {

  loading = true;
  pageIndex = 1;
  pageSize = 15;
  total = 1;
  doc: any = {};
  dataSet = [];
  sdate: any;
  edate: any;
  iscontact:any;
  remarks:any;
  auditstatus:any;
  //提现金额
  cashmoney:any;
  isVisible=false;
  isCrshVisible=false;
  isOkLoading=false;
  LoginUser=RoleRight.getStorage();
  statuslist = [{ key: null, value: '全部' }, { key: 1, value: '审核通过' }, { key: 0, value: '审核中' }, { key: 2, value: '审核拒绝' }];
  constructor( private msg: NzMessageService, private commonservice: CommonService,private agentcashservice:AgentcashserviceService) {
  }

  ngOnInit() {

    this.searchData();
  }
  searchData(reset: boolean = false): void {
    this.loading = true;
    this.agentcashservice.querybypage({
      offset: this.pageIndex,
      limit: this.pageSize,
      auditstatus:this.auditstatus,
      sdate:this.sdate,
      edate:this.edate
    }).then((res) => {
      this.loading = false;
      this.total = res.total;
      this.dataSet = res.rows;
    });
  }

  auditpass(id){
    this.agentcashservice.audit({
      _id:id,
      auditstatus:1
    });
    this.searchData();
  }
  auditrefuse(id){
    this.agentcashservice.audit({
      _id:id,
      auditstatus:2
    });
    this.searchData();
  }
  cash(id){
    this.agentcashservice.audit({
      _id:id,
      casestatus:1
    });
    this.searchData();
  }
}
